package com.hd.crdao.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.hd.crdao.R;
import com.hd.crdao.base.MyBaseAdapter;
import com.hd.crdao.bean.NewCarInfoBean;
import com.hd.crdao.config.Constants;
import com.hd.crdao.utils.UIUtils;
import com.hd.crdao.wrapper.GlideImageUtils;

import java.util.List;

/**
 *
 *@author Programming
 *@date 2017/6/20 0020
 */
public class NewCarInfoAdapter extends MyBaseAdapter<NewCarInfoBean.NewCarListBean> {




    public NewCarInfoAdapter(List<NewCarInfoBean.NewCarListBean> dataSets) {
        super(dataSets);
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = View.inflate(UIUtils.getContext(), R.layout.newcar_detail_item, null);
            viewHolder.mCarPic = (ImageView) convertView.findViewById(R.id.carPic);
            viewHolder.mTvDesc = (TextView) convertView.findViewById(R.id.tvDesc);
            viewHolder.mCarPrice = (TextView) convertView.findViewById(R.id.carPrice);
           // viewHolder.mGuidePrice = (TextView) convertView.findViewById(R.id.guidePrice);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        NewCarInfoBean.NewCarListBean newCarListBean = mDataSets.get(position);
        viewHolder.mTvDesc.setText(newCarListBean.getVehConfig().getVcTypenme());
        viewHolder.mCarPrice.setText(String.valueOf(newCarListBean.getNcPubprice())+"万");
       // viewHolder.mGuidePrice.setText(newCarListBean.getVehConfig().getVcAmount());
        String imageurl = newCarListBean.getPhotoPath();
        GlideImageUtils.loadImage(Constants.IMAGEURL + imageurl,R.drawable.logo_moren_2x,viewHolder.mCarPic);
        return convertView;
    }


    class ViewHolder {
        ImageView mCarPic;
        TextView mTvDesc;
        TextView mCarPrice;
        //TextView mGuidePrice;
    }
}
